package com.day11.test1_jdk8_date;

import java.time.DayOfWeek;
import java.time.LocalDateTime;
import java.time.Month;

/**
 * @author 小坡
 * @date 2022/9/14  15:37
 **/
public class TestJdk8Date {
    public static void main(String[] args) {
        LocalDateTime localDateTime = LocalDateTime.of(2022, 2, 2, 2, 2, 2);
//        public int getYear() 获取年
        int year = localDateTime.getYear();
        System.out.println("年份为" + year);
        int monthValue = localDateTime.getMonthValue();
        System.out.println("月份为" + monthValue);
        int dayOfMonth = localDateTime.getDayOfMonth();
        System.out.println("这是" + dayOfMonth + "号");
        int dayOfYear = localDateTime.getDayOfYear();
        System.out.println("这是一年中的第" + dayOfYear + "天");
        DayOfWeek dayOfWeek = localDateTime.getDayOfWeek();
        System.out.println("星期为" + dayOfWeek);
        int minute = localDateTime.getMinute();
        System.out.println("分钟为" + minute);
        int hour = localDateTime.getHour();
        System.out.println("小时为" + hour);

    }
}
